package main

import "fmt"

func main() {
	TestArrForArrStruct()
}

type Person struct {
	Name string `json:"name"`
	Age  []int  `json:"age"`
}

func TestArrForArrStruct() {
	arr := []Person{
		{
			Name: "1",
			Age:  []int{1, 2, 3, 45},
		},
		{
			Name: "2",
			Age:  []int{3, 4, 5, 67},
		},
	}

	for _, v := range arr {
		if v.Name == "1" {
			v.Age[0] = 33333
		}
	}

	fmt.Println(arr)
}

func TestArrForInt() {
	arr := []int{1, 2, 3, 45}
	for _, v := range arr {
		if v == 1 {
			v = 2222
		}
	}

	fmt.Println(arr)
}
